# -*- coding: utf-8 -*-
# @Time : 2022-03-30 11:39
# @Author : Z
# @Function : web关键字测试


import base64
import time
from Keywords.web_keys import Web

# js滚动页面
# web = Web()
# web.open_browser('')
# web.get_url("http://www.baidu.com")
# web.set_windowsize('700','700')
# web.input("kw","测试")
# web.sleep('4')
# web.click_js('su')
# web.sleep('1')
# web.js_moveto("100","400")
# web.sleep('1')
# # 移动到指定元素位置
# web.js_moveto("//*[text()='下一页 >']")
# web.sleep('1')

# js处理日历控件（修改readonly属性），输入值，去掉属性值
# web = Web()
# web.open_browser()
# web.get_url("https://kyfw.12306.cn/otn/index/init")
# web.sleep('1')
# web.js_input("train_date1","readonly","2022-06-16")
# web.sleep('1000')

# # 格式化时间
# web = Web()
# web.nowtime("%Y-%m-%d %H:%M:%S")
# web.nowtime("%Y")

# 数据库断言
# web = Web()
# web.assertMysql("SELECT * from userinfo where username='Will';", "username", "Will")

# # qq滑块验证码
# web = Web()
# web.openbrowser()
# web.geturl('https://im.qq.com')
# web.click( '//*[@id="loginInfo"]/a')
# web.intoiframe('//*[@name="frame-login"]')
# web.click('//*[@id="switcher_plogin"]')
# web.input('//*[@id="u"]','124913651')
# web.input( '//*[@id="p"]','123wsdf')
# web.sleep("1")
# web.click('//*[@id="login_button"]')
# web.intoiframe('//*[@id="tcaptcha_iframe"]')
# # # actionChains滑动
# # web.slide("//*[@id='slideBg']", "//*[@id='slideBlock']", "//div[@id='e_reload' and @role]/img")
# # pyautogui滑动
# web.slide_qq("//*[@id='slideBg']", "//*[@id='slideBlock']", "//div[@id='e_reload' and @role]/img")

# 京东滑块验证码
# 登陆，进入滑块验证码页面
# web = Web()
# web.open_browser()
# web.get_url('https://passport.jd.com/new/login.aspx')
# web.click('//*[@id="content"]/div[2]/div[1]/div/div[3]/a')
# web.input('//*[@id="loginname"]','test13434')
# web.input('//*[@id="nloginpwd"]','dfsfads')
# web.click('//*[@id="loginsubmit"]')
# web.slide_jd('//*[@id="JDJRV-wrap-loginsubmit"]/div/div/div/div[1]/div[2]/div[1]/img',
#              '//*[@id="JDJRV-wrap-loginsubmit"]/div/div/div/div[1]/div[2]/div[2]/img',
#              '//*[@id="JDJRV-wrap-loginsubmit"]/div/div/div/div[1]/div[2]/div[2]/img')
# web.sleep("1")

# 获取闪烁的图片验证码
# web = Web()
# web.openbrowser()
# web.geturl('https://dispatcher.bywrc.com/dipatchyun_back_web/#/login')
# web.getverify_flashed('//*[@class="code-img"]/img')
# web.sleep('2')
# web.input('//*[@name="code"]', '{verify_base64}')
# web.sleep('6')

# 搜索
# web = Web()
# web.openbrowser()
# web.geturl("http://www.testingedu.com.cn:8000/Admin/Admin/login")
# web.input("//input[@name='username']","admin")
# web.input("//input[@name='password']","123456")
# web.input('//*[@id="vertify"]',"admin")
# web.click('//*[@name="submit"]')
# web.click('//*[text()="商城"]')
# web.intoiframe('//*[@id="workspace"]')
# web.input('//input[@class="qsbox"]','VIP08测试商品10')
# web.click('//input[@class="btn"]')
# web.sleep("12")

# 上传图片
# web = Web()
# web.open_browser('')
# web.get_url("http://www.baidu.com")
# web.click('//*[@id="kw"]/../span[@class="soutu-btn"]')
# web.sleep("2")
# web.click_js('//input[@value="上传图片"]')
# web.upload_image('test.png')
# web.sleep("3")

